package com.controller;

import com.entry.PageBean;
import com.entry.Product;
import com.server.ShoppingProductService;
import com.server.impl.ProductServiceImpl;
import com.server.impl.ShoppingProductServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.soap.Detail;
import java.util.List;

@Controller
public class ListController {

    @Resource
    ProductServiceImpl productService;
    @Resource
    ShoppingProductServiceImpl shoppingProductService;

    @RequestMapping("/product/getproduct")
    public String getproduct(Model model){
        List<Product> productList=productService.getproductList();
        model.addAttribute("productList",productList);
        return "list";
    }
    @RequestMapping( "/product/getproducandproductimageList")
    public String getproducandproductimageList(@RequestParam(value = "currentPage",defaultValue = "1",required = false)int currentPage, Model model, HttpSession session){
        PageBean<Product> pageBean=productService.findProductByPage(currentPage);
        //回显分页数据
        model.addAttribute("pageBean",pageBean);
        session.setAttribute("pageBean",pageBean);
        return "list";
    }
    /*@RequestMapping( "/product/getproducandproductimageList")
    public String getproducandproductimageList(Model model){
        List<Product> productListimg=productService.getproducandproductimageList();
        model.addAttribute("productList",productListimg);
        return "list";
    }*/



}






























